package hhf.flex.soundapi.core.chunks {
	import flash.utils.ByteArray;
	
	import mx.resources.ResourceManager;

	/**
	 * fmtChunk 
	 */
	[ResourceBundle("SoundApiEncoding")]
	public class FmtChunk {
		private var debug:Boolean = false;

		public function FmtChunk(data:ByteArray) {
			encoding = ResourceManager.getInstance().getString("SoundApiEncoding", "0x"+data.readShort().toString(16));
			numChannels = data.readShort();
			log("numChannels : "+numChannels);
			sampleRate = data.readInt();
			log("sampleRate : "+sampleRate);
			avgBytesPerSec = data.readInt();
			log("avgBytesPerSec : "+avgBytesPerSec);
			numBlockAlign = data.readShort();
			log("numBlockAlign : "+numBlockAlign);
			bitsPerSample = data.readShort();
			log("bitsPerSample : "+bitsPerSample);
		}
		public var encoding:String;
		public var numChannels:int;
		public var sampleRate:int;
		public var avgBytesPerSec:int;
		public var numBlockAlign:int;
		public var bitsPerSample:int;

		/**
		 * logging
		 */ 
		private function log(msg:String):void {
			if(debug) {
				trace(msg);			
			}
		}
	}



}